package cn.founder.basic.util;

import lombok.Data;

/**
 * 封装增删改的结果
 * @author boom
 */
@Data
public class AjaxResult {
	
	private Boolean success = true;
	private String msg = "操作成功";
	//后续使用
	private Object resultObj;


	public static AjaxResult myself(){
		return new AjaxResult();
	}

	//失败构造
	public static AjaxResult fail(String message){
		return myself().setSuccess(false).setMessage(message);
	}

	/**
	 * 链式编程思维
	 * @param success
	 * @return
	 */
	public AjaxResult setSuccess(Boolean success) {
		this.success = success;
		return this;
	}

	public AjaxResult setMessage(String message) {
		this.msg = message;
		return this;
	}


	public AjaxResult setResultObj(Object resultObj) {
		this.resultObj = resultObj;
		return this;
	}

}
